#set up the grid x<-y<-seq(-2.5,2.5,by=0.01) #calculate x^2+y^2 sumsq<-function(x,y) x^2+y^2 #evaluate matrix z #for given x and y z<-outer(x,y,"sumsq") #evaluate bivariate standard normal distribution function f<-exp(-z/2)/(2*pi) #draw a filled contour plot with 8 levels filled.contour(x,y,z,nlevels=8, asp=1) ###Roughly matches my 3-d wooden model #draw a filled contour plot with 20 levels filled.contour(x,y,z,nlevels=20, asp=1) #draw a filled contour plot with 100 levels filled.contour(x,y,z,nlevels=100, asp=1) ### The origin in the graph is actually at (-0.86,0), and the ### point with apparent coordinates, (1,0), is at (-0.1,0). ### I want to draw white circles out from the nominal origin to ### remove the shading from outside the circle of radius 2.5. ### To do this, I can take the previous points and change x to ### xp = x*0.76 - 0.86. ### Bit it's depends on the dimension of the window! Ach!! ###Here's code to do this. for (i in seq(2.5,4,by=0.005)) { for (j in seq(0,2*pi,by=0.005)) { xw<-i*cos(j) yw<-i*sin(j) if (max(abs(xw),abs(yw))<2.5) points(xw*0.76-0.86,yw,col="white")}} lines(c(-2.5,2.5)*0.76-0.73,c(2.5,2.5)) lines(c(-2.5,2.5)*0.76-0.73,c(-2.5,-2.5)) lines(c(-2.53,-2.53)*0.77-0.73,c(-2.49,2.49),col="white",lwd=5)